Skip to content

feat(dashboard): daily cost line + This Month timezone fix#151

Open
paulabenzar wants to merge 2 commits into
phuryn:mainfrom
paulabenzar:paula/daily-cost-line
Open

feat(dashboard): daily cost line + This Month timezone fix#151
paulabenzar wants to merge 2 commits into
phuryn:mainfrom
paulabenzar:paula/daily-cost-line

Conversation

@paulabenzar

Copy link
Copy Markdown

Summary

  • Adds an Est. Cost line overlay to the Daily Token Usage chart — a line dataset on a dedicated right-side y-axis (accent color), computed per model before the daily aggregation so per-model pricing is applied correctly. Toggleable via the legend like all other series.
  • Fixes "This Month" including the last day of the previous month in UTC+ timezones: getRangeBounds was using toISOString() (UTC) to format dates constructed from local midnight, which shifted one day back. Now uses getFullYear/getMonth/getDate (local) throughout.

Test plan

  • Open dashboard, select "This Month" — verify only July dates appear (no June 30)
  • Daily Token Usage chart shows an orange Est. Cost line with $ values on the right axis
  • Toggling "Est. Cost" in the legend hides/shows the line
  • Cost line reflects the active model filter and date range
  • All 144 unit tests pass (python3 -m unittest discover -s tests -v)

Adds a per-day cost line (accent color, right y2 axis) on top of the
existing stacked bar chart. Cost is accumulated per model during the
daily aggregation pass so per-model pricing is applied correctly, then
rendered as a Chart.js line dataset with a dedicated y-axis.
…UTC shift

toISOString() outputs UTC, so in UTC+ timezones midnight local time converts
to the previous UTC date — causing "This Month" to include the last day of
the previous month. Use getFullYear/getMonth/getDate (local) instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant